<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul id="nav">
        <li>01</li>
        <li>02</li>
        <li>03</li>
        <li>04</li>
        <li>05</li>
    </ul>
    <script>
        var nav1 = document.querySelectorAll('#nav li');// [li ,li ...]
        var nav2 = document.querySelector('#nav li');// li
        console.log(nav1[0] === nav2);//true  都是选择的第一个li

        //遍历获取到元素集合
        for (var i = 0; i < nav1.length; i++){
            console.log(nav1[i]);
        }
    </script>
</body>
</html>